<!--海外管理-出库管理-->
<template>
  <div class="page-container ">
    <page_breadcrumb :getKeyMethod="init_table_model" @change="change_table_model" pageOption />
    <ex_super_table_page v-bind="option" ref="SuperTablePage" @selection-change="e => selection = e"
      :cell-class-name="cellClassMethod" >
    </ex_super_table_page>
    <!-- <detail_standard_outbound ref="detail_standard_outbound" /> -->
    <report_anomaly ref="report_anomaly" :orderTypeList="['OUTBOUND']" system="WMS" @afterSubmitSuccess="reload()" />
  </div>
</template>
<script>
import business_function from "@/common/business_function"


// import detail_standard_outbound from '@/component/wms/detail_standard_outbound.vue';

import report_anomaly from '@/component/dialog/report_anomaly.vue'


import superTablePageFunction from '@/mixin/super-table-page-function';
import page_table_model_manage from '@/mixin/page_table_model_manage';


import emitOnFunction from '@/mixin/emit-on-function';
let emitKey = 'standard>outbound_manage'
export default {
  title: "label_outbound_cost_resport",
  mixins: [superTablePageFunction, emitOnFunction(emitKey), page_table_model_manage],
  components: {  report_anomaly },
  data() {
    return {
      dialogCreateWavePlan: false,

      option: {
        search: {
          model: [
            { label: "label_outbound_code", key: "outOrderNo", },
            // { label: "label_order_code", key: "omsOrderNo", },
            { label: "label_customer", key: "customerId", type: "common_customer_choose" },
            // { label: "label_outbound_status", key: "status", type: 'select', enum: 'OutboundOrderStatusEunm' },
            //{ label: "label_outbound_type", key: "type",  type: 'select', enum: 'OutboundOrderTypeEnum' },
            { label: "label_track_code", key: "trackNumber", },
            { label: "label_outbound_date", key: "outboundDate1", type: 'date-picker' },
            {
              label: "-",
              key: "outboundDate2",
              type: 'date-picker',
            },
          ],
        },
        actionExtra: [
          {
            label: 'label_export', click: this.exportExcel
          },
        ],
        table: {
          url: "/wms-api/report/WmsOutboundReportRpc/query.json?status=COMPLETE_OUTBOUND",
          model: this.init_table_model(),
        },

      },
      selection: [],

    };
  },


  methods: {
    option_table_model() {
      return [

        { key: 'outDate', label: 'label_operate_time', 'show-overflow-tooltip': true, formatter: (r, c, v, i) => this.$dateFormat(v) },
        { key: 'outStatus', label: 'label_outbound_status', 'min-width': 120, 'show-overflow-tooltip': true, formatter: (r, c, v, i) => this.$enumShow(v, "OutboundOrderStatusEunm") },
        { key: 'trackNumber', label: 'label_order_track_code', 'min-width': 100, 'show-overflow-tooltip': true, },
        { key: 'outOrderNo', label: 'label_outbound_code', 'min-width': 100, 'show-overflow-tooltip': true, },

        { key: 'supplierName', label: 'label_final_supplier', 'min-width': 100, 'show-overflow-tooltip': true, },

        {
          key: 'transportSection', label: 'label_order_type', 'min-width': 120, 'show-overflow-tooltip': true,
          formatter: (r, c, v, i) => this.$enumShow(v, "TransportSectionEnum")
        },
        { key: 'skuCount', label: 'label_sku_count_sum', 'min-width': 100, },
        { key: 'skuInfos', label: 'label_sku_info', 'min-width': 100 },
        { key: 'weight', label: ['label_actual_weight', "(kg)"], 'min-width': 100 },
        { key: 'volume', label: ['label_volume', "(m3)"], 'min-width': 100 },
        { key: 'customerCode', label: 'label_srm_api_request_customer_code', 'min-width': 100 },

        { key: 'amount', label: 'label_order_operate_money', 'min-width': 100 },

      ]
    },

    cellClassMethod({ row, column, rowIndex, columnIndex }) {
      if (column.property == 'outStatus') {
        if (row.outStatus == 'COMPLETE_OUTBOUND') {
          return 'color_success'
        } else if (row.outStatus == 'CANCELED') {
          return 'color_info'
        } else if (row.outStatus == 'SHORT_PICKING') {
          return 'color_danger'
        }
      }
      return ""
    },

    clickDetail(row) {
      // let title = `${this.$tt('label_outbound_code')}:${row.outOrderNo}`
      // this.$refs['detail_standard_outbound'].show({ params: { id: row.id }, title })
      this.$router.push({ path: '/page/wms/overseas/outbound/outbound_detail', query: { code: row.outOrderNo, id: row.id, } })

    },

    exportExcel() {
      const searchParams = this.$refs.SuperTablePage.getSearchData()
      business_function.confirmOperateBaseSelectOrForm.call(this, {
        data: searchParams,
        model: this.option.search.model,
        callback: (selection, data) => {
          let params = data
          this.$functionCommon({
            url: "/wms-api/report/WmsOutboundReportRpc/wmsOutboundCostExport.json?rent=Y",
            data: params, type: 'form', system: 'wms',
          })
        }
      })

    },

  }
};

</script>
<style></style>
